package com.bst.bsj.common.dal.ibatis;

import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.bst.bsj.common.dal.daointerface.MessageDAO;
import com.bst.bsj.common.dal.dataobject.Message;
import com.sylinxsoft.tools.dao.impl.CommonBaseDAOImpl;

@Service("messageDAO")
public class MessageDAOImpl extends CommonBaseDAOImpl implements MessageDAO {

  @Override
  public Long getCounts(Map<String, Object> paramMap) {
    return (Long) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_QUERY_COUNT", paramMap);
  }

  @SuppressWarnings("unchecked")
  @Override
  public List<Message> selectAll(Map<String, Object> paramMap) {
    return (List<Message>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_QUERY_PAGE", paramMap);
  }

  @Override
  public Long insert(Message message) {
    return (Long)getSqlMapClientTemplate().insert(getNameSpace() + ".MS_INSERT", message);
  }

  @Override
  public int delete(Long id) {
    return getSqlMapClientTemplate().delete(getNameSpace() + ".MS_DELETE", id);
  }

}
